-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orderbookv1.1 #35
Open
txhsl
wants to merge
16
commits into
master
Choose a base branch
from
orderbookv1.1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Orderbookv1.1 #35
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Inherit #25. In the past order book and aggregator, we got several problems with the gas fee and stuck orders. Unpredictable aggregation and the high gas fee of FLUND invocation made it expensive to trade with the first order in book, though cheaper to trade with the following because the fundfee is summarized. The result is, we have to pay a high extra sysfee for transactions so that we can deal with a lonely stuck order at the first of the price queue, and it is costive to avoid it in automatic aggregation.
What's Done
buy order price >= sell order price
limit of the order queue, so users will not be forced to trigger any orders before adding a new one in some cases.GetFirstNOrders(UInt160 tokenA, UInt160 tokenB, bool isBuy, uint pos, uint n)
, so that the frontend can query anywhere of the order lists and receipt lists.The total gas cost of limit deal is reduced from 0.4 GAS by 0.2 GAS by removing the automatic aggregation in contract, and the extra sysfee can be reduced from 0.3 GAS to 0.07-0.15 GAS or even 0 if we can predict the payment of FLUND and decide whether to trade with the book.
To Do
The gas payment for clean a stuck order alone are still expensive, they will still get stuck until the next order reach the AMM price. We are considering adding a new endpoint to settle the fundfee instead of doing it in every transaction.
fundAddress
. That will reduce two 0.03? GAS transfers in every transaction.GetFirstNOrders
that takesorderID
as a parameter instead of thepos
.(Evaluating...)